package com.tony.server.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tony.easymvc.mapper.ProjectConfigMapper;
import com.tony.easymvc.po.ProjectConfig;
import com.tony.easymvc.po.ProjectConfigExample;

@Controller
@RequestMapping("config")
public class ProjectConfigController {

	@Resource
	ProjectConfigMapper projectConfigMapper;

	@RequestMapping("list")
	@ResponseBody
	public List<ProjectConfig> list(Integer id) {
		ProjectConfigExample example = new ProjectConfigExample();
		example.or().andProjectIdEqualTo(id);
		return projectConfigMapper.selectByExample(example);
	}

	@RequestMapping("add")
	@ResponseBody
	public String add(ProjectConfig config) {
		projectConfigMapper.insertSelective(config);
		return "操作成功";
	}

	@RequestMapping("delete")
	@ResponseBody
	public String delete(Integer id) {
		projectConfigMapper.deleteByPrimaryKey(id);
		return "操作成功";
	}

}
